#pragma once
#include "osgame.h"
#include "osCamerahandler.h"
#include "ofxVectorMath/ofxVectorMath.h"
#include "colorHandler.h"
class oBall
{
public:
	oBall(ofxVec2f pos, ofxVec2f dir, float radius);
	ofxVec2f pos;
	ofxVec2f dir;
	float radius;

};

class o_o :
	public osGame
{
public:
	o_o(osCamerahandler *camera, colorHandler *colors);
	~o_o(void);
	int lastHitTime;
	const static int playersRadius = 40;
	colorHandler *colors;

	vector<oBall> Balls;
	
	osCamerahandler *camera;
	ofRectangle field;

	vector<ofPoint> players;
	int lifes;
	void draw(int screenoffset);
	void update();
	
	bool collisionWithPlayer();
	bool collisionWithPlayerChain();
	bool lifeLostInLastFrame;
	void resetGame();
	void stopGame();
	void startGame();

	ofxVec2f ClosestPointOnSegment(ofxVec2f p, ofxVec2f p1, ofxVec2f p2);

};

